<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myCustomerLabel">Create or edit a Customer</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!customer.id">
            <label for="id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="customer.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_accountName">Account Name</label>
            <input type="text" class="form-control" name="accountName" id="field_accountName"
                [(ngModel)]="customer.accountName" required />
            <div [hidden]="!(editForm.controls.accountName?.dirty && editForm.controls.accountName?.invalid)">
                <small class="form-text text-danger"
                   [hidden]="!editForm.controls.accountName?.errors?.required">
                   This field is required.
                </small>
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_password">Password</label>
            <input type="text" class="form-control" name="password" id="field_password"
                [(ngModel)]="customer.password" required />
            <div [hidden]="!(editForm.controls.password?.dirty && editForm.controls.password?.invalid)">
                <small class="form-text text-danger"
                   [hidden]="!editForm.controls.password?.errors?.required">
                   This field is required.
                </small>
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_agency">Agency</label>
            <input type="text" class="form-control" name="agency" id="field_agency"
                [(ngModel)]="customer.agency"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_deadline">Deadline</label>
            <div class="input-group">
                <input id="field_deadline" type="text" class="form-control" name="deadline" ngbDatepicker  #deadlineDp="ngbDatepicker" [(ngModel)]="customer.deadline"
                />
                <span class="input-group-btn">
                    <button type="button" class="btn btn-secondary" (click)="deadlineDp.toggle()"><i class="fa fa-calendar"></i></button>
                </span>
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_online">Online</label>
            <input type="number" class="form-control" name="online" id="field_online"
                [(ngModel)]="customer.online"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_heard">Heard</label>
            <div class="d-flex">
                <input id="field_heard" type="datetime-local" class="form-control" name="heard" [(ngModel)]="customer.heard"
                  />
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_status">Status</label>
            <input type="number" class="form-control" name="status" id="field_status"
                [(ngModel)]="customer.status"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_qq">Qq</label>
            <input type="text" class="form-control" name="qq" id="field_qq"
                [(ngModel)]="customer.qq"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" for="field_mobile">Mobile</label>
            <input type="text" class="form-control" name="mobile" id="field_mobile"
                [(ngModel)]="customer.mobile"  />
        </div>

    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span>Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span>Save</span>
        </button>
    </div>
</form>
